<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>组织机构树</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="/bsc/static/common/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="/bsc/static/common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="/bsc/static/css/personal.css" media="all">
</head>
<body bgcolor="red">
<section class="layui-larry-box">
			<div class="larry-personal">
				<div class="layui-tab">
				   <form action="" method="post">
						<!-- <div class="layui-inline">
							<div class="layui-input-inline">
								<input value="" placeholder="请输入菜单名称" class="layui-input search_input" name="menuname" type="text">
							</div>
							<a class="layui-btn search_btn">查询</a>
						</div> -->
						<!-- <div class="layui-inline">
							<a class="layui-btn layui-btn-normal newsAdd_btn">添加菜单</a>
						</div> -->
				   </form>		
					<!-- 操作日志 -->
						<table class="layui-table">
							<colgroup>
								<col width="5%">
								<col width="9%">
								<col width="9%">
								<col width="9%">
								<col width="9%">
								<col width="9%">
								<col width="9%">
								<col width="9%">
								<col width="15%">
							</colgroup>
					<thead>
						<tr style="white-space:nowrap ;text-align:center">
							<th style="text-align:left;">编号</th>
							<th>菜单名称</th>
							<th>菜单类型</th>
							<th>url地址</th>
							<th>备注</th>
							<th>当前状态</th>
							<th>编辑模式</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody class="news_content">
					    <c:if test="${empty menu }">
					    <tr>
					       <td colspan="9">没有数据了</td>
					    </tr>
					    </c:if>
					    
						<c:forEach items="${menu }" var="r" varStatus="s">
						<tr style="white-space:nowrap ;text-align:center"> 
						   <!--style="display: none;"隐藏  -->
						    <td hidden class="td">${r.menu_id }</td>
							<td align="left">${s.index+1 }</td>
							<td>${r.menu_name }</td>
							<td>${r.menu_type=='1'?'系统菜单':'商家菜单' }</td>
							<td>${r.url }</td>
							<td>${r.remark }</td>
							<td>${r.status=='0'?'停用':'启用' }</td>
							<td>${r.edit_mode=='0'?'只读':'可编辑' }</td>
							<td> 
							    <c:if test="${r.status=='0' }">
							        <a class="layui-btn layui-btn-mini news_del" onclick="up('${r.menu_id }','1','启用')" ><i class="iconfont icon-edit"></i> 启用</a>
							    </c:if>
							    <c:if test="${r.status=='1' }">
							        <a class="layui-btn layui-btn-danger layui-btn-mini news_del" onclick="up('${r.menu_id }','0','停用')" data-id="12" ><i class="layui-icon"></i>  停用</a>
							    </c:if>
							       <!--  <a class="layui-btn layui-btn-mini news_edit"  ><i class="iconfont icon-edit"></i> 编辑</a> -->
							</td> 
						</tr>
						</c:forEach>
					</tbody>
					</table>
                     <div class="larry-table-page clearfix">
				          <div id="page" class="page"></div>
			         </div>
</section>
<script type="text/javascript" src="/bsc/static/common/layui/layui.js"></script>
<script type="text/javascript" src="/bsc/static/js/jquery.js"></script>
<script type="text/javascript">
	layui.use(['jquery','layer','element','laypage'],function(){
	      window.jQuery = window.$ = layui.jquery;
	      window.layer = layui.layer;
          var element = layui.element(),
              laypage = layui.laypage;
          /* laypage({
					cont: 'page',
					pages: '${page.total}',//总页数
					groups: 3, //连续显示分页数
					curr: '${page.current}' , //固定当前页
				    
					jump: function(obj, first) {
						//得到了当前页，用于向服务端请求对应数据
						var curr = obj.curr;
						//alert(curr+"   1")
						if(!first) {
							//layer.msg('第 '+ obj.curr +' 页');
							//alert(curr+"   1")
							document.forms[0].action="/bsc/systemuser/listUser?curr="+curr;
							document.forms[0].submit();
						}
					}
				}); */
  	    
  	/* 	//  查询
  		//  查询
	   $(".search_btn").click(function(){
			document.forms[0].action="/bsc/systemmenu/listMenu";
			document.forms[0].submit();
	   }); */
  	    
  	  /*   //修改
  	       //  修改
  	//改变窗口大小时，重置弹窗的高度，防止超出可视区域（如F12调出debug的操作）
   	   $(window).one("resize",function(){
   		$("body").on("click",".news_edit",function(){  //编辑
   			var _this=$(this).parents("tr").find(".td").text();
   		//layer.alert('您点击了文章编辑按钮，由于是纯静态页面，所以暂时不存在编辑内容，后期会添加，敬请谅解。。。',{icon:6, title:'文章编辑'});
   				var index = layui.layer.open({
   					title : "修改",
   					type : 2,
   					content : "",
   					success : function(layero, index){
   						setTimeout(function(){
   							layui.layer.tips('点击此处返回文章列表,不自动保存数据 ', '.layui-layer-setwin .layui-layer-close', {
   								tips: 3
   							});
   						},500)
   					}
   				})			
   				layui.layer.full(index);
   			})
   		}).resize();*/
 }); 
	function up(menuid,stat,a){
		layer.confirm('点击确定将会'+a+'此菜单！！！',{icon:3, title:'提示信息'},function(index){
 			$.ajax({
	             type: "post",
	             url: "/bsc/systemmenu/delmenu",
	             data: {'menuid':menuid,'status':stat},
	             dataType: "json",
	             success: function(data){
	            	 history.go(0);
	             }
            });
 				layer.close(index);
 			});
	}
</script>
</body>
</html>